﻿/*----------------------------------------------------------------
    // Copyright (C) 2009 江苏华招网
    // 版权所有。 
    // 作者：Zeus2 
    //
    // 文件功能描述：采购相关接口
    // 创建标识：周司徒 2009年3月23日
    //
    // 修改标识：
    // 修改描述：
    //
    // 修改标识：
    // 修改描述：
    //
    // 审核人：
    // 审核时间：
    // 审核说明：
 //----------------------------------------------------------------*/

using System;
using System.Collections.Generic;

using System.Text;
using HZ.DrugTrade.Model;
using System.Data;

namespace HZ.DrugTrade.IBLL
{
    /// <summary>
    /// 采购相关胖接口
    /// </summary>
    public interface IBLL_Purchase
    {
        #region 采购单
        /// <summary>
        /// 添加一个采购单
        /// </summary>
        /// <param name="purchaseorder">采购单</param>
        /// <returns></returns>
        int AddPurchaseOrder(PurchaseOrder purchaseorder);

        /// <summary>
        /// 拷贝采购单，自定义名称，起始时间，备注
        /// 然后复制明细
        /// </summary>
        /// <param name="newPurchaseorder">新采购单信息</param>
        /// <param name="oldOrderID">源采购单ID</param>
        /// <returns>0失败，1成功</returns>
        int CopyPurchaseOrder(HZ.DrugTrade.Model.PurchaseOrder newPurchaseorder, string oldOrderID,out string message);

        /// <summary>
        /// 更新采购单起始时间
        /// </summary>
        /// <param name="purchaseorder">采购单</param>
        /// <returns></returns>
        int UpdatePurchaseOrder_StartTime(PurchaseOrder purchaseorder);

        /// <summary>
        /// 更新采购单结束时间
        /// </summary>
        /// <param name="purchaseorder">采购单</param>
        /// <returns></returns>
        int UpdatePurchaseOrder_EndTime(PurchaseOrder purchaseorder);

        /// <summary>
        /// 更新采购单名称
        /// </summary>
        /// <param name="purchaseorder">采购单</param>
        /// <returns></returns>
        int UpdatePurchaseOrder_OrderName(PurchaseOrder purchaseorder);

        /// <summary>
        /// 更新采购单
        /// </summary>
        /// <param name="purchaseorder">采购单(相关属性都得赋值)</param>
        /// <returns></returns>
        int UpdatePurchaseOrder(PurchaseOrder purchaseorder);

        /// <summary>
        /// 删除一个采购单
        /// </summary>
        /// <param name="PurchaseOrder">采购单ID</param>
        /// <returns></returns>
        int DeletePurchaseOrder(PurchaseOrder PurchaseOrder);

        /// <summary>
        /// 更新结算单
        /// </summary>
        /// <param name="invoicepay">结算单(相关属性都得赋值)</param>
        /// <returns></returns>
        int UpdateInvoicePay(InvoicePay invoicepay);

        /// <summary>
        /// 分页获取采购单信息
        /// </summary>
        /// <param name="where">查询实体</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns></returns>
        IList<Model.View.PurchaseOrder> GetPurchaseOrderByWhere(Model.Query.PurchaseOrder where, int currentpage, int pagesize, out int totalrecord);
        /// <summary>
        /// 分页获取发票修改记录
        /// </summary>
        /// <param name="where">查询实体</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns></returns>
        IList<Model.View.Invoice> GetAlterNote(Model.Query.Invoice InvoiceSerialID, int currentpage, int pagesize, out int totalrecord);
        #endregion

        #region 采购单明细
        /// <summary>
        /// 批量删除采购单明细
        /// </summary>
        /// <param name="PurchaseOrderDetailList"></param>
        /// <returns></returns>
        int DeletePurchaseOrderDetail_Batch(IList<PurchaseOrderDetail> PurchaseOrderDetailList);

        /// <summary>
        /// 插入一个采购单明细
        /// </summary>
        /// <param name="PurchaseOrderDetail">采购单</param>
        /// <returns></returns>
        int AddPurchaseOrderDetail(PurchaseOrderDetail PurchaseOrderDetail);
        /// <summary>
        /// 批量插入采购单明细
        /// </summary>
        /// <param name="PurchaseOrderDetailList"></param>
        /// <returns></returns>
        int AddPurchaseOrderDetail_Batch(IList<PurchaseOrderDetail> PurchaseOrderDetailList);

        /// <summary>
        /// 更新采购流程
        /// </summary>
        /// <param name="PurchaseOrderDetail">采购单</param>
        /// <returns></returns>
        int UpdatePurchaseOrderDetail_CurrentNode(PurchaseOrderDetail PurchaseOrderDetail);

        /// <summary>
        /// 更新采购数量
        /// </summary>
        /// <param name="PurchaseOrderDetail"></param>
        /// <returns></returns>
        int UpdatePurchaseOrderDetail_PurchaseCount(PurchaseOrderDetail PurchaseOrderDetail);
        /// <summary>
        /// 撤废采购单
        /// </summary>
        /// <param name="PurchaseOrder"></param>
        /// <returns></returns>
        int DropPurchaseOrder(HZ.DrugTrade.Model.PurchaseOrder PurchaseOrder);
        /// <summary>
        /// 批量更新采购数量
        /// </summary>
        /// <param name="PurchaseOrderDetailList">采购数量列表</param>
        /// <returns></returns>
        int UpdatePurchaseOrderDetail_PurchaseCount_Batch(IList<PurchaseOrderDetail> PurchaseOrderDetailList);
        #endregion

        #region 操作采购单
        /// <summary>
        /// 提交采购单
        /// </summary>
        /// <param name="PurchaseOrderDetail">采购单详细</param>
        /// <returns></returns>
        int UpdatePurchaseOrderDetail_Submit(PurchaseOrder PurchaseOrder);

        /// <summary>
        /// 批量确认采购单明细
        /// </summary>
        /// <param name="PurchaseOrderDetailList">采购单明细列表</param>
        /// <returns></returns>
        int ConfirmPurchaseOrderDetail_Batch(IList<PurchaseOrderDetail> PurchaseOrderDetailList);

        /// <summary>
        /// 拒绝确认采购单明细
        /// </summary>
        /// <param name="PurchaseOrderDetailList">采购单明细列表</param>
        /// <remarks>
        /// 采购单明细ID不能空
        /// </remarks>
        /// <returns></returns>
        int RefuseConfirmPurchaseOrderDetail_Batch(IList<PurchaseOrderDetail> PurchaseOrderDetailList);

        /// <summary>
        /// 批量撤销消确认采购单明细
        /// </summary>
        /// <param name="PurchaseOrderDetailList">采购单明细列表</param>
        /// <returns></returns>
        int UnconfirmPurchaseOrderDetail_Batch(IList<PurchaseOrderDetail> PurchaseOrderDetailList);

        /// <summary>
        /// 更新采购产品确认状态
        /// </summary>
        /// <param name="PurchaseOrderDetail">采购单详细</param>
        /// <returns></returns>
        int UpdatePurchaseOrderDetail_OrderDetailState(PurchaseOrderDetail PurchaseOrderDetail);
       

        #endregion

        #region 出库更新

        /// <summary>
        /// 企业出库更新
        /// </summary>
        /// <param name="Distribution">出库信息</param>
        /// <param name="DistributionBatchRecord">出库单信息</param>
        /// <returns></returns>
        /// <remarks>
        /// 应只更新需要的信息。
        /// </remarks>
        int UpdatePurchaseOrderDetail_Distribution(Distribution Distribution, DistributionBatchRecord DistributionBatchRecord);

        /// <summary>
        /// 批量企业出库更新 
        /// </summary>
        /// <param name="DistributionList">出库信息列表</param>
        /// <param name="DistributionBatchRecordList">出库单信息列表</param>
        /// <returns></returns>
        /// <remarks>
        /// 应只更新需要的信息。
        /// </remarks>
        int UpdatePurchaseOrderDetail_Distribution_Batch(IList<Distribution> DistributionList, IList<DistributionBatchRecord> DistributionBatchRecordList);

        /// <summary>
        /// 批量企业出库修改
        /// </summary>
        /// <param name="DistributionList">出库信息列表</param>
        /// <param name="DistributionBatchRecordList">出库单信息列表</param>
        /// <returns></returns>
        /// <remarks>
        /// 应只更新需要的信息。
        /// </remarks>
        int EditPurchaseOrderDetail_Distribution_Batch(IList<Distribution> DistributionList, IList<DistributionBatchRecord> DistributionBatchRecordList);

        /// <summary>
        /// 批量企业出库删除
        /// </summary>
        /// <param name="DistributionList">出库信息列表</param>
        /// <returns>0 失败 1 成功 2 有产品已入库</returns>
        /// <remarks>
        /// 应只更新需要的信息。
        /// </remarks>
        int DeletePurchaseOrderDetail_Distribution_Batch(IList<Distribution> DistributionList);




        #endregion

        #region 医疗机构【验收】入库
        /// <summary>
        /// 批量更新医疗机构入库【验收】数量(0.不成功,1.成功,)
        /// </summary>
        /// <param name="distributionList">配送情况</param>
        /// <returns>0失败1成功</returns>
        int UpdatePurchaseOrderDetail_Warehouse_Batch(IList<HZ.DrugTrade.Model.Distribution> distributionList, string hospitalID);

         /// <summary>
        /// 批量更新医疗机构入库【验收】数量(0.不成功,1.成功,)
        /// </summary>
        /// <param name="distributionList">配送情况</param>
        /// <returns>0失败1成功</returns>
        int UpdatePurchaseOrderDetail_Warehouse_Batch2(IList<HZ.DrugTrade.Model.View.Distribution> DistributionList, string hospitalID, string hospitalName, string hospitalAreaID);

        #endregion

        #region 是否已开票
        /// <summary>
        /// 批量更新是否开票信息(0.不成功,1.成功,)
        /// </summary>
        /// <param name="distributionList">配送情况</param>
        /// <returns>0失败1成功</returns>
        int UpdatePurchaseOrderDetail_Invoice_Batch(IList<HZ.DrugTrade.Model.Distribution> distributionList);

        #endregion

        #region 未确认采购单
        /// <summary>
        /// 分页获取未确认采购单信息
        /// </summary>
        /// <param name="where">查询实体</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns></returns>
        IList<Model.View.PurchaseOrder_NoConfirm> GetPurchaseOrder_NoConfirmByWhere(Model.Query.PurchaseOrder_NoConfirm where, int currentpage, int pagesize, out int totalrecord);

        #endregion



        #region 采购单相关(企业端)


        #endregion

        #region 采购单配送详细
        /// <summary>
        /// 分页获取出库明细信息
        /// </summary>
        /// <param name="where">查询实体</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns></returns>
        IList<Model.View.Distribution> GetDistribution_Page(Model.Query.Distribution where, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 分页获取采购单详细信息【未配送】
        /// </summary>
        /// <param name="where">查询实体</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns></returns>
        IList<Model.View.PurchaseOrderDetail> GetPurchaseOrderDetail_NoDistributeByWhere(Model.Query.PurchaseOrderDetail where, int currentpage, int pagesize, out int totalrecord);


        /// <summary>
        /// 分页获取采购单配送详细信息【已配送】
        /// </summary>
        /// <param name="where">查询实体</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns></returns>
        IList<Model.View.Distribution> GetPurchaseOrderDetail_DistributeByWhere(Model.Query.Distribution where, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 分页获取采购单详细信息【已验收】
        /// </summary>
        /// <param name="where">查询实体</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns></returns>
        IList<Model.View.Distribution> GetPurchaseOrderDetail_AcceptByWhere(Model.Query.Distribution where, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 分页获取采购单明细信息【余量查询】
        /// </summary>
        /// <param name="where">查询实体</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns></returns>
        IList<Model.View.Distribution> GetPurchaseOrderDetail_BalanceByWhere(Model.Query.Distribution where, int currentpage, int pagesize, out int totalrecord);


        /// <summary>
        /// 分页获取采购单明细信息【过期查询】
        /// </summary>
        /// <param name="where">查询实体</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns></returns>
        IList<Model.View.Distribution> GetPurchaseOrderDetail_OverdueByWhere(Model.Query.Distribution where, int currentpage, int pagesize, out int totalrecord);


        #endregion

        #region 采购单明细
        /// <summary>
        /// 分页获取采购单明细信息
        /// </summary>
        /// <param name="where">查询实体</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns></returns>
        IList<Model.View.PurchaseOrderDetail> GetPurchaseOrderDetailByWhere(Model.Query.PurchaseOrderDetail where, int currentpage, int pagesize, out int totalrecord);


        /// <summary>
        /// 获取采购单中某家企业产品的总金额
        /// </summary>
        /// <param name="strOrderID"></param>
        /// <param name="strCompanyID_PS"></param>
        /// <returns></returns>
        decimal GetPurchaseOrderAmountOfCompany(string strOrderID, string strCompanyID_PS);

        /// <summary>
        /// 获取采购单明细已入库
        /// </summary>
        /// <param name="where"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        IList<Model.View.PurchaseOrderDetail> GetPurchaseOrderDetailInflow_ByWhere(Model.Query.PurchaseOrderDetail where, int currentpage, int pagesize, out int totalrecord);
        #endregion

        #region 退货

        /// <summary>
        /// 添加一个退货单(0.不成功,1.成功,)
        /// </summary>
        /// <param name="returnMerchandise">退货单</param>
        /// <returns>(0.不成功,1.成功,)</returns>
        int AddReturnMerchandise(ReturnMerchandise returnMerchandise);

        /// <summary>
        /// 添加退货单明细
        /// </summary>
        /// <param name="returnMerchandise">待添加的退货单</param>
        /// <param name="detaillist">退货单明细</param>
        /// <returns>(0.不成功,1.成功,)</returns>
        int AddReturnMerchandiseDetail_Batch(ReturnMerchandise returnMerchandise, IList<Model.ReturnMerchandiseDetail> detaillist);
        /// <summary>
        /// 判断退货产品是否在退货流程中 add by zdc
        /// </summary>
        /// <param name="procurecatalogID"></param>
        /// <param name="price"></param>
        /// <param name="orgID"></param>
        /// <returns></returns>
        bool IsReturnning(string procurecatalogID, decimal? price, string orgID);
        /// <summary>
        /// 判断是否已经开发票
        /// </summary>
        /// <param name="procurecatalogID"></param>
        /// <param name="price"></param>
        /// <param name="orgID"></param>
        /// <returns></returns>
        bool IsInvoiced(string procurecatalogID);
        /// <summary>
        /// 批量确认退货单(0.不成功,1.成功,)
        /// </summary>
        /// <param name="returnMerchandiseList">退货单集合</param>
        /// <returns>(0.不成功,1.成功,)</returns>
        int ConfirmReturnMerchandise_Batch(IList<ReturnMerchandiseDetail> list);

        /// <summary>
        /// 批量拒绝退货单(0.不成功,1.成功,)
        /// </summary>
        /// <param name="returnMerchandiseList">退货单集合</param>
        /// <returns>(0.不成功,1.成功,)</returns>
        int RefuseReturnMerchandise_Batch(IList<ReturnMerchandiseDetail> returnMerchandiseList);

        /// <summary>
        /// 批量提交退货单
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        int SubmitReturnMerchandise_Batch_Hospital(IList<ReturnMerchandise> list);
        /// <summary>
        /// 批量更新退货明细
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        int UpdateReturnMerchandiseDetail_Batch_Hospital(IList<ReturnMerchandiseDetail> list);
        /// <summary>
        /// 批量删除退货单
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        int DeleteReturnMerchandise_Batch_Hospital(IList<ReturnMerchandise> list);
        /// <summary>
        /// 批量删除退货单明细
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        int DeleteReturnMerchandiseDetail_Batch_Hospital(IList<ReturnMerchandiseDetail> list);
        /// <summary>
        /// 分页获取退货单详情详情
        /// </summary>
        /// <param name="where">查询实体</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns></returns>
        IList<Model.View.ReturnMerchandiseDetail> GetReturnReturnMerchandiseDetail(Model.Query.ReturnMerchandiseDetail where, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 分页获取退货单信息
        /// </summary>
        /// <param name="where"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        IList<Model.View.ReturnMerchandise> GetReturnReturnMerchandise(Model.Query.ReturnMerchandise where, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 提交退货单
        /// </summary>
        /// <param name="ReturnMerchandise"></param>
        /// <returns></returns>
        int SubmitReturnMerchandise(Model.ReturnMerchandise ReturnMerchandise);

        /// <summary>
        /// 企业获取待确认退货单信息
        /// </summary>
        /// <param name="where"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        IList<Model.View.ReturnMerchandise> GetReturnMerchandis_Company(Model.Query.ReturnMerchandise where, string companyid, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 企业获取已处理退货单信息
        /// </summary>
        /// <param name="where"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        IList<Model.View.ReturnMerchandise> GetTreatedReturnMerchandis_Company(Model.Query.ReturnMerchandise where, string companyid, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 医疗机构获取可退货产品列表
        /// </summary>
        /// <param name="where"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        IList<Model.View.ReturnMerchandiseHospital> GetReturnMerchandis_Hospital(Model.Query.ReturnMerchandiseHospital where, int currentpage, int pagesize, out int totalrecord);




        #endregion

        #region 发票/回款
        /// <summary>
        /// 获取未回款发票企业列表
        /// </summary>
        /// <param name="HospitalID">医疗机构ID</param>
        /// <param name="CompanyName">企业名称</param>
        /// <returns></returns>
        IList<Model.Company> GetUnPayCompanyList(string HospitalID, string CompanyName, int pagesize, int currentpage, out int totalcount);

        /// <summary>
        /// 获取历史有过交易记录的企业
        /// </summary>
        /// <returns></returns>
        System.Data.DataTable GetHistroyTradeCompany(string HospitalID, string CompanyName, string CompaynId, int pagesize, int currentpage, out int totalcount);

        /// <summary>
        /// 获取历史有过交易记录的医疗机构
        /// </summary>
        /// <returns></returns>
        System.Data.DataTable GetHistroyTradeHospital(string HospitalID, string HospitalName, string CompaynId, int pagesize, int currentpage, out int totalcount);

        /// <summary>
        /// 获取未开票企业列表
        /// </summary>
        /// <param name="HospitalID">医疗机构OrgID</param>
        /// <returns>企业列表</returns>
        IList<Model.Company> GetUnInvoiceCompanyList(string HospitalID);


        /// <summary>
        /// 获取未开票医疗机构列表
        /// </summary>
        /// <param name="CompanyID">企业ID</param>
        /// <returns>医疗机构列表</returns>
        IList<Model.Hospital> GetUnInvoiceHospitalList(string CompanyID);

        /// <summary>
        /// 获取未开票医疗机构列表 zdc
        /// </summary>
        /// <param name="CompanyID">企业ID</param>
        /// <returns>医疗机构列表</returns>
        IList<Model.Hospital> GetUnInvoiceHospitalList(string CompanyID, string hospitalName,string where);
        /// <summary>
        /// 添加发票信息 [同时关联配送单信息列表]
        /// </summary>
        /// <param name="invoice">发票信息 【InvoiceSerialID,InvoiceID,CompanyID_PS,HospitalID,InvoiceTime,TotalAmount必填】</param>
        /// <param name="distributionList">出库单信息列表【DistributionSerialID必填】</param>
        /// <returns></returns>
        int AddInvoice_Distribution(Invoice invoice, IList<Distribution> distributionList);

        /// <summary>
        /// 添加发票关联配送单信息详情信息
        /// </summary>
        ///  <param name="invoice">发票信息 【InvoiceID】</param>
        /// <param name="distributionList">出库单信息列表【DistributionSerialID必填】</param>
        /// <returns></returns>
        int AddInvoiceDistribution(Invoice invoice, IList<Distribution> distributionList);

        /// <summary>
        /// 删除发票关联配送单信息详情信息
        /// </summary>
        ///  <param name="invoice">发票信息 【InvoiceID】</param>
        /// <param name="distributionList">出库单信息列表【DistributionSerialID必填】</param>
        /// <returns></returns>
        int DelInvoiceDistribution(HZ.DrugTrade.Model.Invoice invoice, IList<HZ.DrugTrade.Model.Distribution> distributionList);

        /// <summary>
        /// 删除发票【含关联配送单信息详情信息】
        /// </summary>
        ///  <param name="invoice">发票信息 【InvoiceID】</param>
        /// <returns></returns>
        int DelInvoice(HZ.DrugTrade.Model.Invoice invoice);

        /// <summary>
        /// 删除发票_批量【含关联配送单信息详情信息】
        /// </summary>
        ///  <param name="invoiceList">发票信息列表 【InvoiceID】</param>
        /// <returns></returns>
        int DelInvoice_Batch(IList<HZ.DrugTrade.Model.Invoice> invoiceList);

        /// <summary>
        /// 修改发票信息【发票号，发票时间】
        /// </summary>
        /// <param name="invoice">发票信息 </param>
        /// <returns>(0.不成功,1.成功,2.发票编号不存在)</returns>
        int UpdateInvoice(Invoice invoice);

        /// <summary>
        /// 查询发票号是否存在
        /// </summary>
        /// <returns></returns>
        DataTable GetPurchaseNumber(string isID, string InvoiceID);

        /// <summary>
        /// 批量审核通过发票信息
        /// </summary>
        /// <param name="invoiceList">发票信息集合【InvoiceSerialID,AuditPerson必填】</param>
        /// <returns></returns>
        int ConfirmInvoice_Batch(IList<Invoice> invoiceList,string[] arr);
        /// <summary>
        /// 撤废发票
        /// </summary>
        /// <param name="invoiceList"></param>
        /// <returns></returns>
        int DropInvoice_Batch(IList<Invoice> invoiceList);

        /// <summary>
        /// 批量审核不通过发票信息
        /// </summary>
        /// <param name="invoiceList">发票信息集合【InvoiceSerialID,AuditPerson,NoPassReason必填】</param>
        /// <returns></returns>
        int NoConfirmInvoice_Batch(IList<Invoice> invoiceList);

        /// <summary>
        /// 分页获取采购单配送详细信息【未开发票】
        /// </summary>
        /// <param name="where">查询实体</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns></returns>
        IList<Model.View.Distribution> GetPurchaseOrderDetail_DistributeNoInvoiceByWhere(Model.Query.Distribution where, int currentpage, int pagesize, out int totalrecord);


        /// <summary>
        /// 分页获取发票明细信息
        /// </summary>
        /// <param name="where">查询实体</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns></returns>
        IList<Model.View.Invoice> GetInvoiceByWhere(Model.Query.Invoice where, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 分页获取发票配送明细信息
        /// </summary>
        /// <param name="where">查询实体</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns></returns>
        IList<Model.View.InvoiceDistribution> GetInvoiceDistributionByWhere(Model.Query.InvoiceDistribution where, int currentpage, int pagesize, out int totalrecord);


        /// <summary>
        /// 添加发票回款单
        /// </summary>
        /// <param name="invoicePay">发票回款单信息</param>
        /// <param name="invoicelist">发票数组</param>
        /// <returns></returns>
        int AddInvoicePay(InvoicePay invoicePay, IList<Invoice> invoicelist);


        /// <summary>
        /// 批量确认发票回款信息
        /// </summary>
        /// <param name="invoicePayList">发票回款单信息集合【InvoicePaySerialNO必填】</param>
        /// <param name="isPass">true：通过；false：不通过</param>
        /// <returns></returns>
        int ConfirmInvoicePay_Batch(IList<InvoicePay> invoicePayList, bool isPass);


        /// <summary>
        /// 分页获取未回款发票明细信息
        /// </summary>
        /// <param name="where">查询实体</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns></returns>
        IList<Model.View.InvoicePay> GetInvoiceNoPayByWhere(Model.Query.InvoicePay where, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 分页获取已回款发票明细信息
        /// </summary>
        /// <param name="where">查询实体</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns></returns>
        IList<Model.View.InvoicePay> GetInvoicePayByWhere(Model.Query.InvoicePay where, int currentpage, int pagesize, out int totalrecord);


        /// <summary>
        /// 分页获取已回款发票汇总信息
        /// </summary>
        /// <param name="where">查询实体</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns></returns>
        IList<Model.View.InvoicePay> GetTotalInvoicePayByWhere(Model.Query.InvoicePay where, int currentpage, int pagesize, out int totalrecord);


        /// <summary>
        /// 根据回款单查询相关采购汇总信息
        /// </summary>
        /// <param name="where">查询条件</param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        System.Data.DataTable GetPurchaseSumQueryByInvoicePay(Model.Query.ProcureCatalog where, string InvoicePayID, int currentpage, int pagesize, out int totalrecord);


        /// <summary>
        /// 根据配送企业编号分页获取未结算发票明细信息
        /// </summary>
        /// <param name="where">查询实体【配送企业编号必填，可选填：开票时间 发票号 发票总金额】</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns>未结算发票 【开票时间 发票号 发票总金额】</returns>
        IList<Model.View.Invoice> GetInvoiceByCompanyID_PS(Model.Query.Invoice where, int currentpage, int pagesize, out int totalrecord);


        /// <summary>
        /// 删除一个结算单
        /// ()
        /// </summary>
        /// <param name="InvoicePay"></param>
        /// <returns>(1成功 0失败 2已有已确认发票)</returns>
        int DeleteInvoicePay(Model.InvoicePay InvoicePay);
        /// <summary>
        /// 更新结算单所对应的发票
        /// ()
        /// </summary>
        /// <param name="InvoicePay"></param>
        /// <param name="invoicelist"></param>
        /// <returns></returns>
        int UpdateInvoicePay_Detail(Model.InvoicePay InvoicePay, IList<Invoice> invoicelist);
        #endregion

        #region 采购单导入

        /// <summary>
        /// 检查给定的中标序号是否合格
        /// </summary>
        /// <param name="hospitalID"></param>
        /// <param name="procureCatalogIds"></param>
        /// <returns></returns>
        DataTable GetUnExistInSystemProcureCatalog(string hospitalID, string procureCatalogIds);

        /// <summary>
        /// 检查数据有无重复的中标序号
        /// </summary>
        /// <param name="procureCatalogIds"></param>
        /// <param name="DuplicateProcureCatalog"></param>
        /// <returns></returns>
        DataTable GetDuplicateProcureCatalog(string procureCatalogIds);

        /// <summary>
        /// 导入采购单
        /// </summary>
        /// <param name="simpleOrderDetailList"></param>
        /// <param name="newPurchaseorder"></param>
        /// <returns></returns>
        int ImportPurchaseOrder(IList<Model.PurchaseOrderDetail> simpleOrderDetailList, HZ.DrugTrade.Model.PurchaseOrder newPurchaseorder);

        #endregion
         /// <summary>
        /// 查询结算单状态
        /// add by Meng 2013-03-06
        /// </summary>
        /// <param name="qryWhere"></param>
        /// <returns></returns>
        int SelectInvoiceState(HZ.DrugTrade.Model.InvoicePay qryWhere);
          /// <summary>
        /// 查询发票单状态
        /// add by Meng 2013-03-06
        /// </summary>
        /// <param name="qryWhere"></param>
        /// <returns></returns>
        int SelectInvoiceStatus(string InvoiceSerialID);
         /// <summary>
        /// 查询该退货单是否存在
        /// </summary>
        /// <param name="where">查询实体</param>
        /// <param name="currentpage">当前页</param>
        /// <param name="pagesize">页面大小</param>
        /// <param name="totalrecord">记录总数</param>
        /// <returns></returns>
        IList<HZ.DrugTrade.Model.View.ReturnMerchandise> GetReturnReturnMerchandisewhere(string where, int currentpage, int pagesize, out int totalrecord);
           /// <summary>
        /// 查询结算单状态
        /// add by Meng 2013-03-06
        /// </summary>
        /// <param name="qryWhere"></param>
        /// <returns></returns>
        int SelectInvoiceStates(string InvoicePaySerialID);
    }
}
